package com.anji.hyperneat.nd;

import com.anji.nn.activationfunction.ActivationFunction;

public interface ActivatorND {

	/**
	 * @return Number corresponding to cost of network activation in resources.
	 * This function over-estimates the cost, dependent on the ratio of the
	 * connectionMaxRanges to the dimensions of the network.
	 */
	public long cost();

	/**
	 * Return a count of the total number of connections in this network.
	 * 3DRF revisit this... the way coleman calculates this is very different.
	 * @param includeBias Iff true then include bias connections (if they exist for this network).
	 */
	public int getConnectionCount(boolean includeBias);

	/**
	 * Set array to use as the input layer.
	 *
	 * @param inputs The new input pattern. The format is input[ty][tx].
	 * The array should be the same
	 * dimensions as the network, otherwise things will break. The array
	 * is copied by reference, replacing the original first layer activation
	 * array. Changes to newInput after this call outside of this network will
	 * be reflected in the network. The network never changes the input layer.
	 */
	public void setInputs(NDFloatArray inputs);

	/**
	 * Get the input layer.
	 *
	 * @return A reference to the input layer array. The format is input[ty][tx].
	 */
	public NDFloatArray getInputs();

	/**
	 * Retrieve the specified layer; note that this returns a reference to the layer,
	 * modify at your own risk.
	 * @param layer Indicates the layer, any int value between 0 
	 * (the input layer) and N-1 (the output layer), where N is the number of layers.
	 * @return
	 */
	public NDFloatArray getLayer(int layer);
	
	/**
	 * Get output pattern.
	 *
	 * @return A reference to the output pattern. The format is output[ty][tx].
	 * For recurrent networks it's probably not a good idea to modify the
	 * returned array.
	 */
	public NDFloatArray getOutputs();
	
	/**
	 * Retrieve the number of layers in this activator; may return -1 for 
	 * activators that don't use the concept of layers.
	 * @return The number of layers.
	 */
	public int getNumLayers();

	/**
	 * @return True iff this GridNet was created as a feed-forward type, false
	 * otherwise.
	 */
	public boolean isFeedForward();

	public NDFloatArray next(NDFloatArray stimuli);

	public NDFloatArray[] nextSequence(NDFloatArray[] stimuli);

	/**
	 * Resets all activation values to 0.
	 */
	public void reset();

	public String getName();

	public void setName(String string);

	public int[] getInputDimension();

	public int[] getOutputDimension();
	
	public NDFloatArray[] getWeights();

	public NDFloatArray[] getBias();
	
	public NDFloatArray[] getLayers();
	
	public ActivationFunction getActivationFunction();
	
}